﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jzy.Workflow.Node;

using Jzy.Workflow.Line;

namespace Jzy.Workflow.Flow
{
    public partial class FlowInfo
    {
        public FlowInfo()
        {
           
        }

        public Func<int, string> GetTypeName;
        public string _typeName;
        /// <summary>
        /// 类型名称
        /// </summary>
        public string TypeName
        {
            get
            {
                if (_typeName == null)
                {
                    _typeName = GetTypeName(this.TypeCode);
                }
                return _typeName;
            }
            set
            {
                _typeName = value;
            }
        }

        public Func<object, FlowNodeInfo> GetStartNodeInfo;
        private FlowNodeInfo _nodeInfo;
        public FlowNodeInfo StartNode
        {
            get
            {
                if (_nodeInfo == null)
                {
                    _nodeInfo = GetStartNodeInfo(this.ID);
                }
                return _nodeInfo;
            }
            set
            {
                _nodeInfo = value;
            }
        }

        public Func<int, List<FlowNodeInfo>> GetAllNodes;
        private List<FlowNodeInfo> _nodes;
        public List<FlowNodeInfo> Nodes
        {
            get
            {
                if (_nodes == null)
                {
                    _nodes = GetAllNodes(this.ID);
                }
                return _nodes;
            }
            set
            {
                _nodes = value;
            }
        }

        public Func<int, List<FlowLineInfo>> GetAllLines;
        private List<FlowLineInfo> _lines;
        public List<FlowLineInfo> Lines
        {
            get
            {
                if (_lines == null)
                {
                    _lines = GetAllLines(this.ID);
                }
                return _lines;
            }
            set
            {
                _lines = value;
            }
        }
    }

    
}
